# Create Ultrasonic Signals with Oscil

**URL:** <https://forum.csound.com/t/create-ultrasonic-signals-with-oscil/1869>\
**Category:** Newbies\
**Created:** [October 16, 2024, 3:12pm UTC](https://forum.csound.com/t/create-ultrasonic-signals-with-oscil/1869 "2024-10-16T15:12:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diana\_Karle](https://forum.csound.com/user_avatar/forum.csound.com/diana_karle/32/596_2.png) [@Diana\_Karle](https://forum.csound.com/u/Diana_Karle)\
**Post date:** [October 16, 2024, 3:12pm UTC](https://forum.csound.com/t/create-ultrasonic-signals-with-oscil/1869/1 "2024-10-16T15:12:35Z")

</div>

Hi There.  
I am about to re-produce bats calls with csound. What would you recommend, has anyone experience with ultrasonic signals in csound? I tested a simple signal with oscil and it works until aprox. 35kHz. I am using a babyface pro, which is able to 192kHz and so i used the sr too. Thanks fpr ur help. Greets

---

<div class="post-metadata">

**Author:** ![stevenyi](https://forum.csound.com/user_avatar/forum.csound.com/stevenyi/32/4_2.png) [@stevenyi](https://forum.csound.com/u/stevenyi)\
**Post date:** [October 16, 2024, 10:42pm UTC](https://forum.csound.com/t/create-ultrasonic-signals-with-oscil/1869/2 "2024-10-16T22:42:01Z")

</div>

Iain McCurdy gave an exceptional keynote at the Csound Conference in Athlone that talked about using ultrasonic signals. I don’t think the details of that keynote are available online, but you might try contacting him for more information.

---

<div class="post-metadata">

**Author:** ![PvN](https://forum.csound.com/letter_avatar_proxy/v4/letter/p/ccd318/32.png) [@PvN](https://forum.csound.com/u/PvN)\
**Post date:** [October 17, 2024, 9:57am UTC](https://forum.csound.com/t/create-ultrasonic-signals-with-oscil/1869/3 "2024-10-17T09:57:11Z")

</div>

Oh, I would be also very interested in this!

---

<div class="post-metadata">

**Author:** ![Diana\_Karle](https://forum.csound.com/user_avatar/forum.csound.com/diana_karle/32/596_2.png) [@Diana\_Karle](https://forum.csound.com/u/Diana_Karle)\
**Post date:** [October 23, 2024, 8:26am UTC](https://forum.csound.com/t/create-ultrasonic-signals-with-oscil/1869/4 "2024-10-23T08:26:19Z")

</div>

Ok, thanks for the advice ill try, also i will let you know about my experiments. Greets.

---

<div class="post-metadata">

**Author:** ![Diana\_Karle](https://forum.csound.com/user_avatar/forum.csound.com/diana_karle/32/596_2.png) [@Diana\_Karle](https://forum.csound.com/u/Diana_Karle)\
**Post date:** [January 27, 2025, 1:46pm UTC](https://forum.csound.com/t/create-ultrasonic-signals-with-oscil/1869/5 "2025-01-27T13:46:29Z")

</div>

Hi There, I finally managed (thanks to Iain McCurdy) to produce some Ultrasound Signals actually coming quite close to the Sounds you will hear from Pipistrellus and Myotis species. So if you are interested here is the code. Don`t hesitate to contact me 🙂

;-odac

sr = 192000  
ksmps = 32  
nchnls = 2  
0dbfs = 1

instr 99  
; Fledermaus"movement"  
gaEnv2 lfo 30, 0.3  
endin

instr 1

ifreq1 random 86000, 90000  
ifreq2 random 55000, 57000  
ifreq3 random 39000, 41000  
ifreq4 random 25000, 33000

abase transeg 90000, 0.001, 0, ifreq1, 0.0015, 0, ifreq2, 0.002, 1, ifreq3, 0.0012, 2, ifreq4 ; Frequency  
aEnv linseg 0, 0.001, 0.8, 0.0015, 1, 0.001, 1, 0.001, 1, 0.0012, 0 ;Amplitude  
asig\_base poscil aEnv, abase ; Fundamental  
aenv linseg 0.1, 0.0015, 1, 0.002, 1, 0.0012, 0.5, 0.001, 0 ; Envelope  
aall = (asig\_base) \* aenv \* 0.5

; Delay of the Click  
idlt random 0.001, 0.025  
adel delayr idlt ;  
delayw(aall) ; Eingangssignal in den Delay-Buffer schreiben  
aecho = adel \* 0.1 ; Echosignal leicht gedämpft

```
aSig = aall + aecho

```

aSig \*= ampdbfs(gaEnv2-25)

outs aSig, aSig

endin

instr 3  
kindex init 0 ; Hier wird durchgeloopt  
ktime init 0  
imax random 9, 25

loop:  
krandomtime random 0.086, 0.035 ; Zeit zwischen einzlenen Klicks  
ktime += krandomtime ; Wird auf die Zeit vom Vorherigen addiert

```
            event "i", 1, ktime, 0.1 ; Wird als Event aufgerufen

```

kindex += 1

if kindex \< imax kgoto loop; Hüpfen

;----------------------------------------- hier gehts nur einmal am Ende weiter:

krandomtime random 0.2, 1 ; Abstand zwischen letztem Klick und nächstem Klickpaket  
ktime += krandomtime  
event “i”, 3, ktime, 1 ; hier wird dann nochmal instr 3 aufgerufen, aber erst nach ktime  
turnoff

i99 0 60 i3 0 60
