Skip to content

Conversation

@sjhddh
Copy link

@sjhddh sjhddh commented Jan 25, 2026

Summary

  • Introduces a new experimental module that converts stock market data into MIDI sequences
  • Maps Close price to musical pitch via quantized scales (pentatonic, blues, chromatic, dorian, minor)
  • Maps Volume to note velocity (loudness) for dynamic expression
  • Optional volatility-to-duration mapping for more expressive output

Motivation

This module enables users to "listen" to market trends, creating an auditory display of financial data. Useful for:

  • Auditory pattern recognition (hear trends your eyes might miss)
  • Algorithmic art and creative data visualization
  • Accessibility for visually impaired traders

Example Usage

from finrobot.modules.sonification import MarketSynth, generate_melody

# Generate a melody from NVDA stock data
synth = generate_melody("NVDA", "2024-01-01", "2024-12-31", scale="pentatonic")
synth.save_midi("NVDA_2024.mid")

# With custom settings
synth = generate_melody(
    "AAPL", "2024-01-01", "2024-06-30",
    scale="blues",
    tempo=90,
    variable_duration=True,  # Volatility affects note length
    save_path="AAPL_blues.mid"
)

Test Plan

  • Verify midiutil dependency installs correctly
  • Test generate_melody() with various tickers and date ranges
  • Validate MIDI output opens in standard MIDI players
  • Test all 6 scale presets produce valid output

- Replace hardcoded "2023" with actual search date range in error messages
- Replace bare `except:` with `except Exception as e:` for better debugging
- Fix typo "downloaded" -> "download" in error messages
- Use consistent error message format with hyphen separator
FinRobot is a powerful brain, but it lacks a face. This TUI provides a
"Mission Control" interface for observing Agent behavior in real-time.

Features:
- Scrolling ticker bar with live stock prices
- ASCII sparkline charts with key metrics (P/E, RSI, MACD)
- Neural Stream showing agent's chain-of-thought
- Signal panel with BUY/SELL cards and confidence bars
- Demo mode with simulated data (--demo flag)
- AgentDataInterface for real agent integration

Built with Textual and Rich, 100% Python, highly responsive.
Introduces a new way to perceive market data by converting stock history
into MIDI sequences using musical scale mapping.

Features:
- MarketSynth class maps price to pitch, volume to velocity
- Optional volatility-to-duration mapping for expressive output
- 6 scale presets: pentatonic, blues, chromatic, dorian, minor
- Integrates with YFinanceUtils for seamless data fetching

Useful for auditory pattern recognition or algorithmic art.

Example:
  synth = generate_melody("NVDA", "2024-01-01", "2024-12-31")
  synth.save_midi("NVDA_2024.mid")
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

Successfully merging this pull request may close these issues.

1 participant