Csound Csound-dev Csound-tekno Search About

[Csnd] Mic "USB PnP Sound Device" doesn't work

Date2019-07-28 14:23
FromSlobodan Ivanovic
Subject[Csnd] Mic "USB PnP Sound Device" doesn't work
Hello there! I subscribe to the forum 'cause I'm learning Csound. I don't know why it doesn't work 

FILE
#########################################


;CHANGE YOUR INPUT AND OUTPUT DEVICE NUMBER HERE IF NECESSARY!
-iadc0 -odac0 -B512 -b128


;Example by Joachim Heintz
sr = 44100 ;set sample rate to 44100 Hz
ksmps = 32 ;number of samples per control cycle
nchnls = 2 ;use two audio channels
0dbfs = 1 ;set maximum level as 1

giSine    ftgen     0, 0, 2^10, 10, 1 ;table with sine wave

instr 1
aIn       inch      1 ;take input from channel 1
kInLev    downsamp  aIn ;convert audio input to control signal
          printk    .2, abs(kInLev)
;make modulator frequency oscillate 200 to 1000 Hz
kModFreq  poscil    400, 1/2, giSine
kModFreq  =         kModFreq+600
aMod      poscil    1, kModFreq, giSine ;modulator signal
aRM       =         aIn * aMod ;ring modulation
          outch     1, aRM, 2, aRM ;output tochannel 1 and 2
endin


i 1 0 3600


#########################################





OUTPUT
#########################################
...audio buffered in 128 sample-frame blocks
reading 512-byte blks of shorts from adc1 (RAW)
PortAudio V19-devel (built Feb 12 2010 09:42:54)
   0: adc0 (Built-in Microph [Core Audio])
   1: adc1 (USB PnP Sound Device [Core Audio])
PortAudio: selected input device 'USB PnP Sound Device'
   0: dac0 (Built-in Output [Core Audio])
   1: dac1 (USB PnP Sound Device [Core Audio])
PortAudio: selected output device 'Built-in Output'
 *** PortAudio: error: -9998: Invalid number of channels
closing device
Failed to initialise real time audio output
inactive allocs returned to freespace
end of score.		   overall amps:  0.00000  0.00000
	   overall samples out of range:        0        0
1 errors in performance
Elapsed time at end of performance: real: 0.147s, CPU: 0.026s
closing device
#########################################


It says "PortAudio: selected input device 'USB PnP Sound Device" but it does not work.

Any suggestions?

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-07-28 15:41
FromVictor Lazzarini
SubjectRe: [Csnd] Mic "USB PnP Sound Device" doesn't work
try adding

nchnls_i=1

before the line with nchnls=2

to limit input to 1 channel

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 28 Jul 2019, at 14:34, Slobodan Ivanovic  wrote:
> 
> Hello there! I subscribe to the forum 'cause I'm learning Csound. I don't know why it doesn't work 
> 
> FILE
> #########################################
> 
> 
> ;CHANGE YOUR INPUT AND OUTPUT DEVICE NUMBER HERE IF NECESSARY!
> -iadc0 -odac0 -B512 -b128
> 
> 
> ;Example by Joachim Heintz
> sr = 44100 ;set sample rate to 44100 Hz
> ksmps = 32 ;number of samples per control cycle
> nchnls = 2 ;use two audio channels
> 0dbfs = 1 ;set maximum level as 1
> 
> giSine    ftgen     0, 0, 2^10, 10, 1 ;table with sine wave
> 
> instr 1
> aIn       inch      1 ;take input from channel 1
> kInLev    downsamp  aIn ;convert audio input to control signal
>          printk    .2, abs(kInLev)
> ;make modulator frequency oscillate 200 to 1000 Hz
> kModFreq  poscil    400, 1/2, giSine
> kModFreq  =         kModFreq+600
> aMod      poscil    1, kModFreq, giSine ;modulator signal
> aRM       =         aIn * aMod ;ring modulation
>          outch     1, aRM, 2, aRM ;output tochannel 1 and 2
> endin
> 
> 
> i 1 0 3600
> 
> 
> #########################################
> 
> 
> 
> 
> 
> OUTPUT
> #########################################
> ...audio buffered in 128 sample-frame blocks
> reading 512-byte blks of shorts from adc1 (RAW)
> PortAudio V19-devel (built Feb 12 2010 09:42:54)
>   0: adc0 (Built-in Microph [Core Audio])
>   1: adc1 (USB PnP Sound Device [Core Audio])
> PortAudio: selected input device 'USB PnP Sound Device'
>   0: dac0 (Built-in Output [Core Audio])
>   1: dac1 (USB PnP Sound Device [Core Audio])
> PortAudio: selected output device 'Built-in Output'
> *** PortAudio: error: -9998: Invalid number of channels
> closing device
> Failed to initialise real time audio output
> inactive allocs returned to freespace
> end of score.           overall amps:  0.00000  0.00000
>       overall samples out of range:        0        0
> 1 errors in performance
> Elapsed time at end of performance: real: 0.147s, CPU: 0.026s
> closing device
> #########################################
> 
> 
> It says "PortAudio: selected input device 'USB PnP Sound Device" but it does not work.
> 
> Any suggestions?
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here