sox-users@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
* Vary the volume and duty cycle over time
@ 2021-02-24  9:01 Darryl Lewis
  2021-02-24 21:02 ` Dr. Thomas Tensi
  0 siblings, 1 reply; 3+ messages in thread
From: Darryl Lewis @ 2021-02-24  9:01 UTC (permalink / raw)
  To: sox-users@lists.sourceforge.net


[-- Attachment #1.1: Type: text/plain, Size: 386 bytes --]

I’m trying to simulate a square wave signal. So far I have this, which should be a 400Hz square wave.

play -V -r48000 -n synth square 400 0 0



Is there

  1.  A way to make the amplitude rise and fall over time?
  2.  Vary the duty cycle over time, from say 300Hz to 600Hz and back down to 300Hz then repeat?



Any advice welcomed.

Thanks in advance.

Darryl


[-- Attachment #1.2: Type: text/html, Size: 4061 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Vary the volume and duty cycle over time
  2021-02-24  9:01 Vary the volume and duty cycle over time Darryl Lewis
@ 2021-02-24 21:02 ` Dr. Thomas Tensi
  2021-02-24 21:26   ` Darryl Lewis
  0 siblings, 1 reply; 3+ messages in thread
From: Dr. Thomas Tensi @ 2021-02-24 21:02 UTC (permalink / raw)
  To: sox-users

Hello Darryl,


you wrote:
 > I’m trying to simulate a square wave signal. So far I have this,
 > which should be a 400Hz square wave.
 > play -V -r48000 -n synth square 400 0 0

This looks quite realistic to me.

 > Is there
 >  1. A way to make the amplitude rise and fall over time?

This is easy: you can either use another synth modulation or a tremolo:

     play -r48000 -n synth square 400 0 0 synth sine amod 0.5

or

     play -r48000 -n synth square 400 0 0 tremolo 0.5 50

where tremolo also allows to set the modulation depth via its second
parameter.

 >  2. Vary the duty cycle over time, from say 300Hz to 600Hz and back down
 >     to 300Hz then repeat?

I am not sure whether you mean a pulse width modulation or a frequency
modulation (the latter sounds like a frequency modulation...)?  In
principle some sort of frequency modulation is possible via fmod instead
of amod above, but it is a double-sideband suppressed-carrier amplitude
modulation and not a real frequency modulation as you request.

I do not know of a genuine frequency modulation in real-time.

But when real-time is not required, you could define a sweep parameter
for the synth like e.g.

     sox -r 48000 -n part1.wav synth 5 square 300-600
     sox -r 48000 -n part2.wav synth 5 square 600-300
     play part1.wav part2.wav

The kind of sweep can be specified by giving either '+' '-' '/' or ':'
as the separator between frequencies.

Hope this helps!


	Best regards,

		Thomas


_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Vary the volume and duty cycle over time
  2021-02-24 21:02 ` Dr. Thomas Tensi
@ 2021-02-24 21:26   ` Darryl Lewis
  0 siblings, 0 replies; 3+ messages in thread
From: Darryl Lewis @ 2021-02-24 21:26 UTC (permalink / raw)
  To: thomas@tensi.eu, sox-users@lists.sourceforge.net

Thank you Thomas, 
I think you've answered my questions.

On 25/2/21, 8:11 am, "Dr. Thomas Tensi" <t.tensi@gmx.de> wrote:

    Hello Darryl,


    you wrote:
     > I’m trying to simulate a square wave signal. So far I have this,
     > which should be a 400Hz square wave.
     > play -V -r48000 -n synth square 400 0 0

    This looks quite realistic to me.

     > Is there
     >  1. A way to make the amplitude rise and fall over time?

    This is easy: you can either use another synth modulation or a tremolo:

         play -r48000 -n synth square 400 0 0 synth sine amod 0.5

    or

         play -r48000 -n synth square 400 0 0 tremolo 0.5 50

    where tremolo also allows to set the modulation depth via its second
    parameter.

     >  2. Vary the duty cycle over time, from say 300Hz to 600Hz and back down
     >     to 300Hz then repeat?

    I am not sure whether you mean a pulse width modulation or a frequency
    modulation (the latter sounds like a frequency modulation...)?  In
    principle some sort of frequency modulation is possible via fmod instead
    of amod above, but it is a double-sideband suppressed-carrier amplitude
    modulation and not a real frequency modulation as you request.

    I do not know of a genuine frequency modulation in real-time.

    But when real-time is not required, you could define a sweep parameter
    for the synth like e.g.

         sox -r 48000 -n part1.wav synth 5 square 300-600
         sox -r 48000 -n part2.wav synth 5 square 600-300
         play part1.wav part2.wav

    The kind of sweep can be specified by giving either '+' '-' '/' or ':'
    as the separator between frequencies.

    Hope this helps!


    	Best regards,

    		Thomas


    _______________________________________________
    Sox-users mailing list
    Sox-users@lists.sourceforge.net
    https://lists.sourceforge.net/lists/listinfo/sox-users


_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-24 21:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-24  9:01 Vary the volume and duty cycle over time Darryl Lewis
2021-02-24 21:02 ` Dr. Thomas Tensi
2021-02-24 21:26   ` Darryl Lewis

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).