No video

Wavetable Synthesis in Rust?? Rust Basics Tutorial [Synth

  Рет қаралды 13,145

WolfSound

WolfSound

Күн бұрын

Пікірлер: 49
@WolfSoundAudio
@WolfSoundAudio 2 жыл бұрын
Have I helped you with this video? If yes, please, consider buying me a ☕ coffee at www.buymeacoffee.com/janwilczek Thanks! 🙂
@albertoromero1934
@albertoromero1934 2 жыл бұрын
I find myself really lucky to finally find a great resource including both Rust and Audio programming!! Please continue making videos, this was a really insightful video
@WolfSoundAudio
@WolfSoundAudio 2 жыл бұрын
I am very happy to hear that! I will continue with Rust and audio for sure :)
@albertoromero1934
@albertoromero1934 2 жыл бұрын
Can I ask you which resources would you recommend for a completely newbie to get started with audio and music programming?
@flyingsquirrel3271
@flyingsquirrel3271 2 жыл бұрын
"Its syntax is similar to C++ so it's easy to learn" There is so much wrong about this sentence, don't even get me started :'D Love your videos btw.! Very nice that you're using rust here, it would be awesome if you'd do more rust related stuff in the future :)
@WolfSoundAudio
@WolfSoundAudio 2 жыл бұрын
Haha, I may be biased ;) Thanks for the feedback! How about "How to interface JUCE with Rust?" :)
@flyingsquirrel3271
@flyingsquirrel3271 Жыл бұрын
@michelnielsen2855 My comment was mostly about the stance that C++ would be easy to learn. I'd say C++ is one of the hardest languages to learn of them all. I wouldn't even call it _one_ language, since everyone uses a different subset of that insane, messy pile of syntax and language features. And on top of that you have all these different build systems and toolings. Learning Rust is much, _much_ easier than learning C++. There are amazing resources freely available, the compiler errors are incredibly helpful and the community is also super nice and helpful (at least that was my experience). If I imagine being a newcomer who doesn't know C++ or Rust, there is absolutely no competition there, because C++ would lose before even writing my first line of code in it.
@craig_z
@craig_z Жыл бұрын
Great video! One correction needed though: this is not a "wavetable" (at least as defined by Wolfgang Palm, who invented this type of synthesis) - it is just one single cycle waveform. A "wavetable" would be 64 (for example) such single cycle waveforms. An example might be a gradual morphing of the sine wave you have here into a sawtooth wave. Position in the wavetable can be controlled via an envelope or some other modulation to create complex and interesting sounds.
@dusterthefirst
@dusterthefirst 2 жыл бұрын
I really enjoyed the video. Your explanations of what each thing you are doing is very clear and would be very useful to rust beginners. Rather than just throwing rust concepts at the viewer, you make sure to walk them through your process of why you did what you did and also explain what language features you used to achieve it.
@WolfSoundAudio
@WolfSoundAudio 2 жыл бұрын
Thank you so much for the feedback, Duster! If that's your impression of the video, I am more than happy because (as you might imagine) that had been precisely my goal!
@CHE6yp
@CHE6yp Жыл бұрын
Small nitpick, you don't actually need to call convert_samples() on your oscillator (line 57), since it already returns f32 values
@andres-hurtado-lopez
@andres-hurtado-lopez 9 ай бұрын
Hello: Really nice videos you have out there about the topic of wave table synthesis. I have learned quite a bit. On the rust side of things here is a tip you might like. If you want squeeze a little bit more of performance you could do the following: Use the stack instead of the heap memory. Instead of using a Vec you could use an Array leveraging on the fact that you are using a fixed table. Stack variables have way more faster access than heap ones. You could reformulate your struct like this without sacrificilt the posibility of the ability to parametrize the size of the wave table: struct WaveTableOscillator{ sample_rate: u32, wave_table: [f32; N], index: f32, index_increment: f32, } And then when you initialize you structure you could define at compile time any arbitrary size of the table including value initialization with no cost at runtime: let a = WaveTableOscillator{ sample_rate: Default::default(), wave_table: [0.0f32; 64], index: Default::default(), index_increment: Default::default(), }; Another trick could be to switch the data types of the index from f32 to i32 which are way more faster to compute and using from Rust's standard library the "simd" module to run the functions parallel calculations for floats to boost even more. Nice job you did here!
@juanma3333
@juanma3333 2 жыл бұрын
wow! I'm learning rust and I also like audio synthesis in software. Awesome!
@WolfSoundAudio
@WolfSoundAudio 2 жыл бұрын
I'm happy to hear that, thanks!🙂
@from_right_to_left
@from_right_to_left 2 жыл бұрын
Great video and corresponding article! I'm trying to like programming as a hobby again, so Rust and audio are my main source of interest
@WolfSoundAudio
@WolfSoundAudio 2 жыл бұрын
Awesome to hear, thank you! More Rust content will come :)
@Talel_kraiem
@Talel_kraiem Жыл бұрын
Man I never been happier to try and build my first synth from scratch thank you hell a lot , this been my introduction to audio programming 🥰🥰🥰🥰
@WolfSoundAudio
@WolfSoundAudio Жыл бұрын
Great to hear!
@rotteegher39
@rotteegher39 Жыл бұрын
I didn't even knew this video existed. I already having a running process in my system that does exactly that. about 2 month ago I coded simple program in Rust that runs in infinite loop and "beeps" a 440hz sinewave for 200 ms using rodio library, so that I remind myself to drink water while I'm at my computer (I tend to forget I need to stay hydrated) The binary is literally called "beep" and runs in a background systemd service
@bakdiabderrahmane8009
@bakdiabderrahmane8009 9 ай бұрын
I would to see a whole playlist on studio programming with rust.
@bigstick256
@bigstick256 4 ай бұрын
this video taught me so much about Rust and Audio at the same time. Thanks.
@guidofazzito
@guidofazzito 3 ай бұрын
Please make more videos about Rust!! Such a great language
@thelenardjourney8525
@thelenardjourney8525 2 жыл бұрын
Hey man would absolutely love if you made more videos expanding on this tutorial. I'm a rust engineer and also love making music and me and my friends wanna make VST plug-ins for ourselves. This was super useful but would love to get more explanation and learn how to develop more complex stuff because this is all unchatered territory for me. Looking forward to seeing the next video king
@WolfSoundAudio
@WolfSoundAudio 2 жыл бұрын
Hi, thank you for the feedback! I'm really happy to learn that you liked the video :) I plan to do a video on how to integrate Rust with JUCE to make VST plug-ins. Would you be interested in that? :)
@thelenardjourney8525
@thelenardjourney8525 2 жыл бұрын
@@WolfSoundAudio yes, I’d be very interested in watching this vid. Keen to see it when it’s done.
@aaronocelot
@aaronocelot 2 жыл бұрын
This is awesome, many layers of precisely what I was seeking to learn.
@jonatasdp
@jonatasdp 2 жыл бұрын
Very good intro! thanks for walking through all this and exposing Rust concepts too :)
@WolfSoundAudio
@WolfSoundAudio 2 жыл бұрын
Thank you for the feedback, I really appreciate it :)
@saysthetedd
@saysthetedd Жыл бұрын
I would love to see more Rust videos from you! Very glad you are making this channel. It's something I have wished existed for a while! Cheers
@kertjalukse757
@kertjalukse757 Жыл бұрын
I wrote my first lines of rust today and still managed to code along. What I find most fascinating about rust is the ERROR MESSAGES! First "cargo run" got me like 13 errors, but I managed to solve them all in like 2 minutes just by reading the error messages: just so clear, what was wrong.
@JoeyLindsay
@JoeyLindsay Жыл бұрын
That is the best part about Rust. This is actually how they found bugs in LLVM which is what Rust initially used before being written in itself 😂
@Havoid
@Havoid Жыл бұрын
You made it seem so natural and simple to make a synth. Great content!
@adamazoulay9090
@adamazoulay9090 Жыл бұрын
More rust projects please!!!!
@nicholascarr8654
@nicholascarr8654 Жыл бұрын
Where was convert_samples() defined for WavetableOscillator?
@DominiHarling
@DominiHarling 2 жыл бұрын
Makes me think of my childhood programming sound on a commodore Vic-20. Only 100x more complicated. :) but 100x more cool, too.
@WolfSoundAudio
@WolfSoundAudio 2 жыл бұрын
Haha, thanks a lot! Glad you like it :)
@JakubGaka
@JakubGaka 2 жыл бұрын
Great video, thanks for sharing.
@WolfSoundAudio
@WolfSoundAudio 2 жыл бұрын
Thank you for the feedback!
@tpb2
@tpb2 7 ай бұрын
Great video, thanks! I tried this and got a 440 hz tone hat looks like a truncated triangle wave - also sounds too nice to be a simple sine. Any ideas? Best Regards, Tom.
@faycarsons
@faycarsons 8 ай бұрын
This behaves very unpredictably < 110hz, any idea why? Also, you don't have to use the 'return' keyword in Rust, the last expression gets returned automatically if you don't end it w/ a semi-colon.
@hostnik777
@hostnik777 6 ай бұрын
Why would you pick one framework or another for audio VSTs? Like why do this in Rust instead of using Juce or something else?
@JoeyLindsay
@JoeyLindsay Жыл бұрын
I was wondering if it’s possible to make this compile to WASM since I wanted to make a web based platform independent DAW
@jeffholland4248
@jeffholland4248 2 жыл бұрын
Amazing tutorial, thank you so much! How did you configure VS Code to autocomplete everything for you? I installed the Rust extension for VS Code, but it still doesn't autocomplete. A video on how you configure your development environment would be incredibly helpful.
@WolfSoundAudio
@WolfSoundAudio 2 жыл бұрын
Hi Jeff, thanks for the feedback! Look up the tabnine plugin; it uses machine learning to improve on its suggestions 😉
@EJGMpollo
@EJGMpollo Жыл бұрын
Incredible work!
@Johnny-tw5pr
@Johnny-tw5pr Жыл бұрын
Audio is very choppy? Why?
@WolfSoundAudio
@WolfSoundAudio Жыл бұрын
Do you mean the clicks? Well, there is no fade-in and no fade-out.
@bonaoenchelcha
@bonaoenchelcha Жыл бұрын
omg bro esto no es real!
@jax3520
@jax3520 Жыл бұрын
Thanks for the video! very interesting. I followed your video bit by bit and still got like 20 errors when running "cargo run", and no audio. :/ See below: | 23 | self.index_increment = frequency * self.wave_table.len() as f32 / self, | ^ expected one of 8 possible tokens error: expected one of `:`, `@`, or `|`, found `)` --> src\main.rs:27:32 | 27 | fn get_sample(&mut_self) -> f32 { | ^ expected one of `:`, `@`, or `|` | = note: anonymous parameters are removed in the 2018 edition (see RFC 1685) help: if this is a `self` type, give it a parameter name | 27 | fn get_sample(self: &mut_self) -> f32 { | +++++ help: if this is a parameter name, give it a type | 27 | fn get_sample(mut_self: &TypeName) -> f32 { | ~~~~~~~~~~~~~~~~~~~ help: if this is a type, explicitly ignore the parameter name | 27 | fn get_sample(_: &mut_self) -> f32 { | ++ error: expected one of `(`, `.`, `::`, `;`, `?`, `}`, or an operator, found `increment` --> src\main.rs:29:38 | 29 | self.index += self.indrx increment; | ^^^^^^^^^ expected one of 7 possible tokens error: expected one of `!`, `(`, `+`, `::`, `;`, ` src\main.rs:35:40 | 35 | let truncated_index: usize - self.index as usize; | ^ expected one of 7 possible tokens error: expected one of `:`, `;`, ` src\main.rs:48:19 | 47 | impl Iterator for WavetableOscillator { | - while parsing this item list starting here 48 | type Item - f32; | ^ expected one of `:`, `;`, ` src\main.rs:78:13 | 78 | for n in: usize in 0..wave_table_size{ | ^ expected expression error[E0424]: expected value, found module `self` --> src\main.rs:28:31 | 27 | fn get_sample(&mut_self) -> f32 { | ---------- this function doesn't have a `self` parameter 28 | let sample: f32 = self.lerp(); | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | help: add a `self` receiver parameter to make the associated `fn` a method | 27 | fn get_sample(&&self, mut_self) -> f32 { | ++++++ warning: unused import: `OutputStream` --> src\main.rs:3:13 | 3 | use rodio::{OutputStream, Source}; | ^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default error[E0747]: constant provided when a type was expected --> src\main.rs:13:47 | 13 | fn new(sample_rate: u32, wave_table: Vec) -> WavetableOscillator{ | ^^
Wavetable Synthesis Algorithm Explained [Synth #001]
27:40
WolfSound
Рет қаралды 12 М.
Whoa
01:00
Justin Flom
Рет қаралды 54 МЛН
هذه الحلوى قد تقتلني 😱🍬
00:22
Cool Tool SHORTS Arabic
Рет қаралды 91 МЛН
An Introduction to Coding In Rust for Pythonistas
20:42
ArjanCodes
Рет қаралды 125 М.
Programming a synth in Rust using CPAL and FunDSP!
51:36
Mo chreach!
Рет қаралды 1,9 М.
Ian Hobson (Independent) - Rusty Grains (Granular Synthesis in Rust)
50:43
The Audio Programmer
Рет қаралды 3,1 М.
An introduction to Rust for audio developers - Ian Hobson
49:49
ADC - Audio Developer Conference
Рет қаралды 24 М.
Why is the JavaScript ecosystem switching to Rust?
48:08
chris biscardi
Рет қаралды 130 М.
Writing a Rust-based ring buffer
40:01
timClicks
Рет қаралды 6 М.
Top 5 Languages For Audio Programming
15:46
WolfSound
Рет қаралды 8 М.
When Zig Outshines Rust | Prime Reacts
23:31
ThePrimeTime
Рет қаралды 139 М.
Rust's Most Important Containers 📦 10 Useful Patterns
17:11
Code to the Moon
Рет қаралды 121 М.
Whoa
01:00
Justin Flom
Рет қаралды 54 МЛН