dwhinham / mt32-pi

🎹🎶 A baremetal kernel that turns your Raspberry Pi 3 or later into a Roland MT-32 emulator and SoundFont synthesizer based on Circle, Munt, and FluidSynth.
https://twitter.com/d0pefish
GNU General Public License v3.0
1.28k stars 81 forks source link

Oled flickering on and off under 8.4 #70

Closed Xargon321 closed 3 years ago

Xargon321 commented 3 years ago

Tried upgrading to 8.4 today and my oled started flickering on and off once you started to play music it would stay on but i think it was trying to turn off but every time a note hit it would come back on made it look like it was refreshing weird

I tried replacing all the files and just replacing kernel8 same thing as soon as i roll back to 8.3 it works as is should

Its a rbi3+ and using ssd1306_i2c oled screen

dwhinham commented 3 years ago

Please post full details of your screen and where you got it from, and also attach your config file.

Thanks!

Xargon321 commented 3 years ago

https://www.amazon.com/gp/product/B08L7QW7SR/ref=ppx_yo_dt_b_asin_title_o05_s00?ie=UTF8&psc=1

that's the ones i got and my config file is here

      __ ________  ________                  .__

__/ |_ \ _ \ __ || / \ _( < / __/ __ __ | | | Y Y \ | / \/ \ /___/ | |_> > | ||| /|/____ /____ \ | /|| \/ \/ \/ |__|

mt32-pi.cfg: mt32-pi configuration file.

Default options are marked with an asterisk (*).


System options

[system]

Set the default synthesizer to be made active on startup.

If the default synthesizer is unavilable (e.g. missing ROMs or SoundFonts), the first working synth is made active.

Values: mt32*, soundfont

mt32: Use mt32emu (Munt) for Roland MT-32 emulation soundfont: Use FluidSynth for SoundFont synthesis default_synth = mt32

Set the I2C baud rate/clock speed for all peripherals (Hz).

Most peripherals will work fine at the default speed (400KHz "fast mode"), but larger LCD/OLED displays (e.g. 4-line I2C HD44780 and 64 pixel high SSD1306) won't be able to refresh at 60FPS at the default setting.

Try increasing this value to 1000000 (1MHz) for a smoother LCD refresh rate. If your display doesn't work, try backing off the speed 100KHz at a time until it does.

Values: 100000-1000000 (400000*) i2c_baud_rate = 400000

Set the timout for power saving mode (seconds).

After the specified number of seconds of silence, the CPU clock speed will be reduced, the audio device will be stopped, and and the LCD's backlight will be turned off to save energy (certain I2C displays only).

Any MIDI activity will instantly bring the system out of power saving mode.

If set to 0, power saving mode is disabled.

Values: 0-3600 (300*) power_save_timeout = 300


MIDI options

[midi]

Enable or disable searching for a USB MIDI interface on startup.

Disable this to speed up boot time if you are using GPIO for MIDI. If no USB MIDI devices are detected, GPIO will be used as a fallback.

Values: on*, off usb = off

Set the baud rate used for GPIO MIDI.

For connecting to standard MIDI devices (i.e. via DIN cable), this should be left at the default rate of 31250.

For connecting to PCs, set this to match the baud rate of the other host. SoftMPU's serial MIDI mode, for example, uses a baud rate of 38400.

Values: 300-4000000 (31250*) gpio_baud_rate = 31250

Enable or disable software "MIDI thru" on the GPIO Tx pin.

When enabled, all data received via the GPIO Rx pin will be re-transmitted verbatim on the Tx pin. This may be useful for debugging or for passing MIDI data through to another synth.

Values: on, off* gpio_thru = off


Audio options

[audio]

Select audio output device.

Values: pwm*, i2s

pwm: Use the headphone jack i2s: Use an I2S DAC output_device = i2s

Sample rate of audio output (Hz).

mt32emu uses an internal sample rate of 32000Hz (just like the real hardware) which is then resampled to this value.

FluidSynth renders at this sample rate directly.

Values: 32000-192000 (48000*) sample_rate = 48000

Set audio rendering chunk size (samples).

A single stereo frame of audio has two samples, and so this value is double the number of frames per chunk. The smaller the chunk size, the lower the latency, but too low a value will cause underruns (distortion artifacts).

Latency is a function of chunk size and sample rate, for example: 256 samples / 2 channels / 48000Hz * 1000ms = 2.67ms of latency. See documentation for recommended values for various Raspberry Pi models.

The minimum value varies depending on audio output device. For PWM, the minimum is 2, for I2S the minimum is 32.

Values: 2-2048 (256*) chunk_size = 256

Set address (hexadecimal) of I2C DAC control interface.

This will be used for the initialization sequence (see below) if enabled. You can find the address of your DAC by using the i2cdetect utility in Linux.

Values: 00-80 (4c*) i2c_dac_address = 4c

Select an initialization sequence for the DAC.

Some DACs require some initialization commands to be sent via I2C before they will produce any sound.

Values: none*, pcm51xx

pcm51xx: for DACs based on PCM5121 or similar (e.g. PCM5141, PCM5242) i2c_dac_init = none


Control options

[control]

Set the physical control scheme.

See documentation for GPIO pinouts/wiring details.

Values: none*, simple_buttons, simple_encoder

none: No physical controls simple_buttons: Simple 4-button scheme simple_encoder: Simple 2-button + rotary encoder scheme scheme = none

Set the rotary encoder type (if used by control scheme).

Different rotary encoders may complete different fractions of a Gray-code cycle per detent ("click").

If four clicks are needed for a single movement, try "quarter". If two clicks are needed for a single movement, try "half".

Values: quarter, half, full* encoder_type = full

Enable or disable the I2C MiSTer control interface.

If using mt32-pi with a MiSTer FPGA system and custom hardware to interface with MiSTer's User Port, enable this option to allow controlling mt32-pi via the MiSTer's on-screen display.

Values: on, off* mister = off


MT-32 emulator options

[mt32emu]

Select quality level for the resampler.

If set to none, audio output will sound wrong unless you set the sample rate option to 32000Hz, which is the MT-32's native sample rate.

Values: none, fastest, fast, good*, best resampler_quality = good

Select initial MIDI channel assignment.

The MT-32 uses an unusual MIDI channel assignment by default. On a real MT-32 this is set using a button combination. Use this option to change the initial channel assignment on startup.

Values: standard*, alternate

standard: Parts 1-8 = MIDI channels 2-9, Rhythm part = MIDI channel 10 alternate: Parts 1-8 = MIDI channels 1-8, Rhythm part = MIDI channel 10 midi_channels = standard

Select initial ROM set to use.

If multiple ROM sets are available, this option determines which set to use on startup. If the ROM set specified here is unavailable, the first available set is used instead.

Values: old*, new, cm32l rom_set = old


SoundFont synthesizer options

[fluidsynth]

Set the initial SoundFont to use.

If multiple SoundFonts are available, this option determines which SoundFont to use on startup.

On startup, the "soundfonts" directory is scanned for valid SoundFonts, which are added to a list and sorted into alphabetical order.

This setting is a zero-indexed offset into that list (i.e. 0 is the first, 1, is the second, and so on).

If the index specified is unavailable, the first available SoundFont will be used.

Values: 0-255 (0*) soundfont = 0

Set the master volume gain.

The default is a low value to avoid clipping when many notes are playing at once.

The value should be a decimal value between 0.0 and 10.0. Values outside this range will be clamped.

Values: 0.0-10.0 (0.2) gain = 0.2

Set the maximum number of voices that can be played simultaneously.

Depending on the complexity of your SoundFont, you may need to reduce this value to prevent audio buffer underruns (distortion) when playing music featuring lots of notes being played at once.

On the other hand, Raspberry Pi 4 users may want to try raising this value as it has a more powerful CPU.

N.B. larger file size of the SoundFont does not imply higher CPU usage. SoundFonts that use more real-time effects (modulators) are more likely to require a reduction in polyphony.

Values: 1-65535 (256*) polyphony = 256


LCD/OLED display options

[lcd]

Select LCD driver.

Note that LCDs connected via I2C, you must also set the correct address for your device via the i2c_lcd_address option. Consult its datasheet, or see our documentation for tested models and their configurations.

Values: none*, hd44780_4bit, hd44780_i2c, ssd1306_i2c

none: No LCD hd44780_4bit: Hitachi HD44780 or compatible (e.g. WS0010, RS0010) character LCD connected to GPIO pins in 4-bit mode (see documentation for pinout) hd44780_i2c: As above, but using an I2C "backpack" ssd1306_i2c: Small I2C-based OLED graphical display type = ssd1306_i2c

Set the width of the LCD.

If the display is a character display, this value is measured in characters. Otherwise, for a graphical display, this is measured in pixels.

Note that not all dimension settings are valid; see documentation for valid configurations for each LCD driver.

Values: 20-128 (128*) width = 128

Set the height of the LCD.

Same characters vs. pixels considerations as for width.

Values: 2-64 (32*) height = 32

Set address (hexadecimal) of I2C LCD.

This will be used to communicate with LCDs connected via the I2C bus.

Values: 00-80 (3c*) i2c_lcd_address = 3c

Rotate the display output (graphical LCDs only).

Some graphical displays support rotation. Use this option if you need to turn the display around.

Values: normal*, inverted

normal: No rotation inverted: The display output is upside down rotation = normal

dwhinham commented 3 years ago

Thanks for the info, your config was of course fine.

I was able to quickly reproduce it here, sadly I broke 128x32 screens in the last version - sorry about that!

Please test this build here: https://github.com/dwhinham/mt32-pi/actions/runs/551181587 You can just download the "kernels" archive and replace the kernels on your SD card.

Xargon321 commented 3 years ago

all working like it should