> For the complete documentation index, see [llms.txt](https://nxp.gitbook.io/mr-b3rb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nxp.gitbook.io/mr-b3rb/advanced-untested-and-rough-notes/modifying-cognipilot-tones-advanced.md).

# Modifying Cognipilot tones (advanced)

This note is for code inside of Cognipilot, and should be considered more advanced. It is included here only for reference.

If you want to play around with making your own:

```
import numpy as np

def create_sound(tone_name, freq_max, freq_min, duration_sec, num_phases, steps):
    print('struct tones_t {:s}[] = {{'.format(tone_name))
    amp = (freq_max-freq_min)/2
    for i in np.linspace(0, duration_sec, num=steps, endpoint=True):
        note = freq_min+amp*(1+np.sin(np.pi*(num_phases/duration_sec)*i))
        note_str = '    {{ .note = {:d}, .duration = {:d} }},'.format(int(note), int((duration_sec/steps)*1000))
        print(note_str)
    print('    { .note = REST, .duration = whole },')
    print('};')

create_sound('b3rb_reject_tone', 2500, 150, .75, 2.5, 60)
```

And all I did was insert this at very top of generated tone:&#x20;

```
struct tones_t b3rb_reject_tone[] = {
    { .note = 110, .duration = half },
    { .note = REST, .duration = thrirtysecond },
```
