-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Applications: Add SampleEditor audio editing application #26402
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
base: master
Are you sure you want to change the base?
Conversation
SampleEditor is a graphical audio sample editor supporting WAV and FLAC file formats. It provides essential audio editing functionality including playback, waveform visualization, and clipboard operations. Key features: - WAV and FLAC format support for loading and saving - Real-time audio playback with configurable start positions - Copy/cut/paste operations with format validation - Reference-based architecture for memory-efficient editing - Zoom controls for waveform inspection - Keyboard shortcuts for all common operations The application uses a block-based design where audio content is represented as file references (SampleFileBlock) or silence (SampleNullBlock). Copy/paste operations store file paths and ranges in the clipboard, creating new references when pasted rather than duplicating audio data. This allows efficient editing of large files without loading everything into RAM.
LucasChollet
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I will definitely want to give this a look, but that will be in a long time (more than a week).
In the meantime, here are some hints that I suggest you to consider (I only had a glance so don't consider them as final, and you can also wait until I come back):
- Maybe remove the editing capacities (especially the clipboard part) from this PR and add them in another one. It seems to be a big chunk of code, so putting it apart will probably ease the review process.
- I'm not sure why you need
SampleNullBlockcan't you have that backed inSampleBlock? - It seems like only
SampleSourceFileinherits fromSampleFilemaybe there is no need to have an abstract class.
|
|
||
| #pragma once | ||
|
|
||
| typedef struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No typedef please, this is not C code.
| #include <AK/Vector.h> | ||
| #include <LibAudio/Sample.h> | ||
|
|
||
| #include <cassert> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use our asserts: VERIFY and friends.
Thanks, that would be great, as mentioned on Discord this has been very long term for me, so expecting it to be a gradual process with likely revisions needed on my part. Taking those points fully on board, but just by way of a little explanation:
|
Overview
SampleEditor is a graphical audio sample editor that provides essential editing capabilities for WAV and FLAC audio files.
Features
Implementation Details
The application uses a reference-based block architecture:
SampleFileBlock- References portions of audio files on diskSampleNullBlock- Represents silenceSampleBlockContainer- Manages sequences of blocks and handles streamingCopy/paste operations work by storing file paths and sample ranges in the clipboard as JSON.
When pasting, new file block references are created pointing to the original source files rather than duplicating data in memory. This allows editing large audio files efficiently.
Files Added
Userland/Applications/SampleEditor/- Main application source (~2800 LOC, 11 source files)Base/res/apps/SampleEditor.af- Application metadataBase/res/icons/{16x16,32x32}/app-sample-editor.png- Application iconsBase/usr/share/man/man1/Applications/SampleEditor.md- User documentationTesting Performed
Screenshots