I tried the :square
and :pulse
synths, but they produced the waveform shown in the picture below.
How can I achieve a standard square wave in Sonic Pi ?
Can someone help me with this problem ?
I tried the :square
and :pulse
synths, but they produced the waveform shown in the picture below.
How can I achieve a standard square wave in Sonic Pi ?
Can someone help me with this problem ?
That is a square wave through a highpass filter, I guess supercollider applies one around 8Hz (midi note 0).
Hi
The LFPulse oscillator in SC is non-band-limited (if that is what Sam chose for the square and/or pulse synths); according to the Sonic Pi docs both those synths are low-pass filtered. But all square and pulse oscillators are approximations, right? To smooth the sharp corners and prevent aliasing.
PD-Pi
The SP mixer (accessible with !set_mixer_control) has a highpass that defaults to midi note 0 but I don’t know if that means it’s bypassed or just set below audio range.
I wouldn’t worry about it though, that filtering will happen in your audio interface and amplifier anyway and it’s typically at a cutoff frequency below audio range.
What frequency is that ?
How are you measuring ?
Usually computers do not put out accurate waveshapes .
Hi
this may be tangential to your question but: something I initially struggled with when I first encountered Sonic Pi was my expectation of what it is for, and what it can do (the following makes absolutely no assumption of your own level of expertise or experience).
For many years I used Ableton Live, MaxMSP, Pure Data, Supercollider and the like in my creative and professional pursuits. So, I expected Sonic Pi to offer similar synthesis options, whether explicitly or ‘under the hood’. It doesn’t. So, what is its USP? Live coding and sequencing of musical events in realtime, via a transparent and sophisticated coding language and environment.
Any of my occasional frustrations with Sonic Pi stem from my misconception of what it is for and what it can do - not any limitations of the program itself.
Again, I make no assumption of your experience with Sonic Pi.
PD-Pi
Thank you for your advice. I’ve only been using Sonic Pi for a few days, and I’m not very familiar with making electronic music yet. After going through the Sonic Pi tutorial, I couldn’t find a way to generate a standard square wave. I’m used to driving a buzzer with a PWM signal (a standard square wave), so I tried to apply the same concept in Sonic Pi. However, I understand that making music in this environment is different from working with hardware, so having a non-standard waveform isn’t a big issue. The built-in synthesizers are already quite sufficient for my needs.
Sorry for the misunderstanding. The second wave was a representation, not an actual waveform. I’m used to generating PWM signals with microcontrollers, like Arduino, and the waveform of a PWM signal is similar to the second wave.
Yes, there’s some really nice synths - I especially like hollow, pluck and dark ambience.
Welcome to the Sonic Pi community
PD-Pi
Thank you for your guidance! Since the filtering happens anyway, I won’t worry about it and will focus on making music.
Looking forward to what you create!
Even with something like :
https://www.szynalski.com/tone-generator/
most computer sound circuits
won’t do an accurate waveshape .