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

Key Error when running some of the examples #32

Open
soleyhyman opened this issue Oct 2, 2024 · 0 comments
Open

Key Error when running some of the examples #32

soleyhyman opened this issue Oct 2, 2024 · 0 comments

Comments

@soleyhyman
Copy link

I've just recently downloaded STRAUSS and have been playing around with the examples. In several of the examples where there is a chord used, I've been getting a Key Error when I try to run the cells. For example, in the AudioCaption example, when I try to run the sonification function in third cell (without the captioning), i.e.,

#caption_en = 'In the following audio, a glockenspiel is used to represent stars of varying colour.'

# render at default 48 kHz rate
soni = Sonification(score, events, generator, system) #, caption=caption_en)
soni.render()
soni.notebook_display(show_waveform=0)

I get the following error:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[12], [line 6](vscode-notebook-cell:?execution_count=12&line=6)
      [4](vscode-notebook-cell:?execution_count=12&line=4) soni = Sonification(score, events, generator, system)
      [5](vscode-notebook-cell:?execution_count=12&line=5)                     # caption=caption_en)
----> [6](vscode-notebook-cell:?execution_count=12&line=6) soni.render()
      [7](vscode-notebook-cell:?execution_count=12&line=7) soni.notebook_display(show_waveform=0)

File c:\Users\soley\anaconda3\envs\soni\Lib\site-packages\strauss\sonification.py:162, in Sonification.render(self, downsamp)
    [159](file:///C:/Users/soley/anaconda3/envs/soni/Lib/site-packages/strauss/sonification.py:159) sourcemap['note'] = note
    [161](file:///C:/Users/soley/anaconda3/envs/soni/Lib/site-packages/strauss/sonification.py:161) # run generator to play each note
--> [162](file:///C:/Users/soley/anaconda3/envs/soni/Lib/site-packages/strauss/sonification.py:162) sstream = self.generator.play(sourcemap)
    [163](file:///C:/Users/soley/anaconda3/envs/soni/Lib/site-packages/strauss/sonification.py:163) playlen = sstream.values.size
    [164](file:///C:/Users/soley/anaconda3/envs/soni/Lib/site-packages/strauss/sonification.py:164) if 'phi' in sourcemap:

File c:\Users\soley\anaconda3\envs\soni\Lib\site-packages\strauss\generator.py:871, in Sampler.play(self, mapping)
    [865](file:///C:/Users/soley/anaconda3/envs/soni/Lib/site-packages/strauss/generator.py:865) utils.linear_to_nested_dict_reassign(mapping, params)
    [866](file:///C:/Users/soley/anaconda3/envs/soni/Lib/site-packages/strauss/generator.py:866) # for p in self.preset.keys():
    [867](file:///C:/Users/soley/anaconda3/envs/soni/Lib/site-packages/strauss/generator.py:867) #     if p not in mapping:
    [868](file:///C:/Users/soley/anaconda3/envs/soni/Lib/site-packages/strauss/generator.py:868) #        mapping[p] = self.preset[p]
    [869](file:///C:/Users/soley/anaconda3/envs/soni/Lib/site-packages/strauss/generator.py:869) 
    [870](file:///C:/Users/soley/anaconda3/envs/soni/Lib/site-packages/strauss/generator.py:870) # sample to use
--> [871](file:///C:/Users/soley/anaconda3/envs/soni/Lib/site-packages/strauss/generator.py:871) samplefunc = self.samples[params['note']]
    [873](file:///C:/Users/soley/anaconda3/envs/soni/Lib/site-packages/strauss/generator.py:873) # note length
    [874](file:///C:/Users/soley/anaconda3/envs/soni/Lib/site-packages/strauss/generator.py:874) if params['note_length'] == 'sample':

KeyError: 'Db3'

Do you have any idea what might be causing this and/or how to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant