Add audio signal output example (#94)
This commit is contained in:
parent
f6cd300ec8
commit
9c701415c0
1 changed files with 12 additions and 0 deletions
12
README.md
12
README.md
|
@ -100,3 +100,15 @@ julia> buf = read(stream, 10s)
|
|||
julia> close(stream)
|
||||
|
||||
julia> save(joinpath(homedir(), "Desktop", "myvoice.ogg"), buf)
|
||||
```
|
||||
|
||||
### Play an audio signal through the default sound output device
|
||||
|
||||
```julia
|
||||
using PortAudio, SampledSignals
|
||||
S = 8192 # sampling rate (samples / second)
|
||||
x = cos.(2pi*(1:2S)*440/S) # A440 tone for 2 seconds
|
||||
PortAudioStream(0, 2; samplerate=Float64(S)) do stream
|
||||
write(stream, x)
|
||||
end
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue