Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand saving output example #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions tutorial/chapters/BasicTypesTutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,22 @@ The `readWav` and `loopWav` can read the file with given speed.
The 1 is a normal speed. The -1 is playing in reverse.
Negative speed works only for `loopWav`.

So we can read our friends record like this:
So we can read *.wav file like this:

~~~{.haskell}
let sample = loopSnd "Composite.wav"
$ ghci
Prelude> :m +Csound.Base
Prelude Csound.Base> -- play the *.wav file
Prelude Csound.Base> dac $ readSnd "Composite.wav"
Prelude Csound.Base> -- continuously play the *.wav file
Prelude Csound.Base> dac $ loopSnd "Composite.wav"
Prelude Csound.Base> -- set period of continuous play to 2 seconds
Prelude Csound.Base> dac $ loopSndBy 2 "Composite.wav"
Prelude Csound.Base> -- set speed of playback
Prelude Csound.Base> dac $ readWav 2 "Composite.wav"
Prelude Csound.Base> -- continuously play at the set speed
Prelude Csound.Base> dac $ loopWav 3 "Composite.wav"
Prelude Csound.Base> :q
~~~

If we want only a portion of the sound to be played we can use the
Expand Down
9 changes: 8 additions & 1 deletion tutorial/chapters/ProducingTheOutputTutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ Let's write a 10 seconds of concert A (440 Hz). We can use it
for tuning:

~~~haskell
> writeSnd "A.wav" $ setDur 10 $ osc 440
$ ghci
Prelude> :m Csound.Air.Wave Csound.Options Csound.IO
Prelude Csound.Air.Wave Csound.Options Csound.IO> writeSnd "A.wav" $ setDur 10 $ osc 440
Prelude Csound.Air.Wave Csound.Options Csound.IO> :q
$ file A.wav
A.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 44100 Hz
$ aplay A.wav
Playing WAVE 'A.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
~~~

The audio is going to be rendered off-line. The good thing
Expand Down