Note Block Assistant
无需 AI 的软件
Note Block Assistant 由人类亲手打造,出于对编程艺术的热爱以及对亲自审视软件内部机制这一传统的尊重。
本模组中没有任何代码是由大语言模型(LLM)或“AI”工具生成的。
概述
Note Block Assistant 是一款用于制作音符盒乐曲的工具模组。它旨在自动化我个人制作音符盒乐曲时的手动步骤,特别是压缩环节。如果你也觉得它有帮助,那就太好了!
Note Block Assistant 提供了三个命令:
/nba generate 根据指定的长度、拍号以及乐器方块参数生成一个模板(即音符盒下方的支撑方块)。
/nba select 加载已完成的乐曲并进行验证,为压缩做好准备。
/nba placeCompact 将压缩后的乐曲放置到世界中。你可以指定压缩版本的长度,或者让命令选择一个使结果尽可能接近正方形的长度,以达到最佳的聆听效果。(参见画廊中的截图以查看压缩后的乐曲!)
Note Block Assistant 需要 Fabric API 才能运行。它不需要任何配置;只需将其添加到你的客户端(单人游戏)或服务器即可使用!
使用方法
注意:建议同时安装 WorldEdit。Litematica 也很有用(在生存模式下构建最终乐曲时几乎是必需的)。
Note Block Assistant 在超平坦风格的世界中效果最佳。
生成模板
要开始一首新曲子,请使用 /nba generate 命令来生成模板。该命令的格式如下:/nba generate <measures> <beatsPerMeasure> <subdivisionsPerBeat> <subdivisionDelay> <instrumentBlock> [additional instrument blocks...]
时间参数的用法如下:
-
measures:控制要在乐曲模板中生成多少个小节。
-
beatsPerMeasure:控制每个小节生成多少个节拍。这通常对应于音乐记谱法中的拍号分子;例如,如果你的乐曲是 3/4 拍,则输入 3。对于某些拍号,选择其他数字可能更有用——例如,在传统上 6/8 拍的小节中,通常每小节使用两个节拍,每个节拍包含三个细分。
-
subdivisionsPerBeat:控制每个小节中的每个节拍被划分成多少份。它代表了你乐曲中可以拥有的最短音符。例如,在 3/4 拍中,如果你的最短音符是八分音符,则使用 2;如果你的乐曲包含十六分音符,则使用 4。如果你使用的是复合拍号如 6/8,则需要相应调整细分:如果每小节有两个节拍,而你想包含十六分音符,则 subdivisionsPerBeat 应设为 6。
-
subdivisionDelay:控制每个细分的长度——也就是你乐曲的速度。Note Block Assistant 生成的乐曲是由音符盒(或占位方块)行组成的,中间由红石中继器控制每个音符之间的时间间隔;因此,这个数字是每个生成的中继器设置的刻数。该值可以设为 1、2、3 或 4,每个中继器刻等于 0.1 秒。示例:
- 当
subdivisonsPerBeat 为 2 且 subdivisionDelay 为 2 时,每个细分长度为 0.2 秒,每个节拍为 0.4 秒,因此最终速度为 150 bpm。
- 当
subdivisionsPerBeat 为 3 且 subdivisionDelay 为 1 时,每个细分长度为 0.1 秒,每个节拍为 0.3 秒,因此最终速度为 200 bpm。
该系统限制了可实现的速度范围,但这通常是不可避免的。你需要选择合适的细分延迟以尽可能接近所需的速度。
虽然 Note Block Assistant 仅生成具有单一细分延迟的模板,但选择和压缩系统会保留你对中继器时间的修改。因此,如果你的乐曲主要以八分音符作为细分,只有少数几个较短的音符,那么有可能基于八分音符生成模板,然后在特定位置进行调整以添加较短的音符。请记住,如果你缩短了一个中继器的时间,你需要延长下一个中继器以弥补,或者将整个模板的剩余部分向后移动(WorldEdit 对此类更改非常有用)。
在时间参数之后,你可以输入最多九个乐器方块参数。这些是 Minecraft 方块,将在音符盒放置位置的下方生成。如果你想制作带有木琴和长笛声音的乐曲,可以使用 minecraft:bone_block minecraft:clay 来生成两条音轨,一条用于木琴,一条用于长笛。注意,每条音轨只能播放一个音符,所以如果你希望木琴演奏和弦,你可能需要添加额外的 minecraft:bone_block 来获得更多音轨。你也可以始终使用 minecraft:air 来生成没有乐器方块的音轨。
虽然模板生成器限制每条音轨只有一个乐器方块,但你可以更换乐器方块以临时改变声音,选择和压缩系统会保留这些更改。因此,例如如果你想加入打击乐,即使使用多种乐器,你也可能只需要一或两条音轨。交替使用低音鼓和军鼓的节奏可以在一条音轨上完成:使用 minecraft:stone 生成低音鼓的音轨,然后将军鼓的节奏替换为沙子,最后重复该模式直到乐曲结束(WorldEdit 的 //stack 命令非常适合重复模式)。
创建您的乐曲
生成模板后,您面前会出现一行方块。这是您的标记线(marker line)。它作为时间轴,显示小节和拍子的对齐位置,方便您追踪进度。钻石方块标记每个小节的第一个音符,金块标记该小节内后续每个拍子的第一个音符。
在标记线的右侧,会生成您的音轨。音轨以三个为一组进行生成,中心轨道上放置中继器以传递红石信号。第二层的平滑石头方块是音符空白位;将其替换为音符方块即可添加音符。请注意,在每个组中,第一条音轨在中心生成,第二条在左侧生成,第三条在右侧生成。这是因为如果某个组只有一条音轨,它必须位于有中继器的中心位置。因此,如果您生成了一个包含九条音轨的模板,布局将是:
M 2 1 3 5 4 6 8 7 9
这起初可能令人惊讶,但在压缩后会提供最有效的最终布局。
要聆听您的乐曲,只需使用红石导线将按钮连接到每条中心轨道的第一个音符方块或空白位。按下按钮,然后飞越乐曲上方以保持能听到的位置。(完成后,压缩功能将生成一个您可以站在原地聆听的版本。)
压缩您的乐曲
当您对一切满意时,Note Block Assistant 可以将您完成的乐曲生成为紧凑版本,通过将音轨折叠使音符方块互锁,并将每组三条音轨放置在单独的层上。这样,您的乐曲就从一条漫长且笨拙(但易于编辑)的线条变成了一个占用空间最小、如需可在生存模式下建造的 3D 建筑。(虽然可以使用 WorldEdit 做到这一点,但这需要一些数学计算和大量麻烦,这也是最初创建此模组的原因。)
要压缩您的乐曲,首先站在标记线上第一个钻石方块之上,并面向标记线的另一端。然后,使用命令 /nba select <tracks>,其中 tracks 是您乐曲中的音轨数量。Note Block Assistant 将沿着您面对的方向扫描标记线以计算乐曲长度,然后扫描并存储所有音符方块、乐器方块、中继器和空白位。
因此,虽然在创作过程中您可以更换乐器方块并缩短/延长乐曲,但您的标记线必须保持完整,且您不能更改音轨相对于标记线的位置。
Note Block Assistant 会告诉您它找到的乐曲长度。如果正确无误,请飞到附近位置并运行 /nba placeCompact 以生成紧凑版本。为了减少在生存模式下建造所需的资源,Note Block Assistant 会自动从紧凑版本中移除任何不需要的音符空白位和乐器方块,因此无需事先手动执行此操作。默认情况下,将为每一层生成玻璃地板,以使建造更加实用并固定任何掉落的乐器方块(如沙子或砾石)。您可以使用 WorldEdit 将地板替换为其他材质,或者根据需要将其移除。在此阶段,您也可以将平滑石头方块替换为任何其他可被充能的实心方块。
默认情况下,Note Block Assistant 生成的紧凑乐曲尽可能接近正方形,以便您可以站在中心,所有音符方块都将处于最小距离且可被听到。但是,如果您的乐曲需要适应特定区域,生成不同的矩形形状可能更有用。如果是这种情况,您可以使用 /nba placeCompact <length> 指定矩形一边长度的方块数,乐曲将自动调整宽度以适应该长度。请注意,在一端方向上需要额外的长度供红石导线环绕,因此在每行末尾循环,所以虽然音符方块将放入您指定的尺寸中,但最终形状会根据您选择 <length> 的矩形边而略有不同。
一旦您对紧凑乐曲的形状满意,就可以将其作为参考在生存模式下进行建造(Litematica 模组无疑是最佳方式)。然后,连接一个红石电路以同时为每一层的第一个音符方块充能。实现方法有很多,具体取决于您希望如何触发乐曲以及建造地点,因此 Note Block Assistant 不会生成这部分内容。
Note Block Assistant
AI-Free Software
Note Block Assistant is proudly built by human hands, as a labor of love for the art of programming and the tradition of looking into the guts of a piece of software with one's own eyes.
No code within this mod was created by LLM or "AI" tools.
Overview
Note Block Assistant is a utility mod for making note block songs. It's designed to automate the manual steps in the way
I personally make note block songs, particularly the compaction step. If you also find it helpful, wonderful!
Note Block Assistant provides three commands:
/nba generate generates a template with the specified parameters for length and meter, as well as instrument blocks
(the blocks that go underneath the note blocks).
/nba select loads the completed song and validates it, preparing it for compaction.
/nba placeCompact places a compacted version of the song into the world. You can specify the length of the compacted
version, or let the command choose a length that gets the result as close to square as possible for optimal listening. (See the Gallery for a screenshot of a compacted song!)
Note Block Assistant requires Fabric API to work. It doesn't need any configuration; you can just add it to your client
(for single-player) or server and use it!
How to use
Note: It's a good idea to have WorldEdit installed alongside Note Block Assistant. Litematica is also useful
(practically necessary) to build the final song in survival.
Note Block Assistant works best in a superflat-style world.
Generating a template
To start a new song, use the /nba generate command to generate a template. This command takes the form: /nba generate <measures> <beatsPerMeasure> <subdivisionsPerBeat> <subdivisionDelay> <instrumentBlock> [additional instrument blocks...]
The timing parameters are used as follows:
-
measures: This controls how many musical measures/bars to generate in your song template.
-
beatsPerMeasure: This controls how many beats to generate for each measure. This is generally the top number of the
time signature in music notation; for example, if your song is in 3/4 time, you would enter 3. For certain time
signatures it may be useful to choose a different number -- it's traditional in 6/8 time, for example, to use two
beats per measure with three subdivisions per beat.
-
subdivisionsPerBeat: This controls how many times to divide each beat of the measure. It represents the shortest
note that you can have in your song. For example, in 3/4 time, if your shortest note is an 8th note, you would use
2; if your song has 16th notes, you would use 4 instead. If you're using a compound time signature like 6/8,
you'll need to adjust your subdivisions accordingly: with 2 beats per measure, if you want to include 16th notes,
you would use subdivisionsPerBeat of 6.
-
subdivisionDelay: This controls the length of each subdivision -- and therefore the tempo of your song. Note Block
Assistant generates songs that are rows of note blocks (or placeholder blocks) with repeaters in between controlling
the time between each note; therefore, this number is the number of ticks each generated repeater is set to. This can
be set to 1, 2, 3, or 4, with each repeater tick equal to 0.1 seconds. Examples:
- With
subdivisonsPerBeat of 2 and subdivisionDelay of 2, each subidivion is 0.2s long and each beat is 0.4s,
so the final tempo is 150 bpm.
- With
subdivisionsPerBeat of 3 and subdivisionDelay of 1, each subdivision is 0.1s long and each beat is
0.3s, so the final tempo is 200 bpm.
This system does limit the tempos that can be achieved, but that is generally unavoidable. You'll need to choose your
subdivision delay to get as close as possible to the desired tempo.
Although Note Block Assistant only generates templates with a single subdivision delay, the selection and compaction
system will preserve modifications that you make to the repeater timings. So, if your song has predominantly eighth
notes as the subdivision and only a couple of shorter notes, it may be possible to generate a template based on the
eighth note and then adjust in one spot to add the shorter notes. Remember that if you shorten one repeater, you'll
need to either lengthen the next one to make up for it, or shift the remainder of your template over (WorldEdit is
useful for this sort of change).
After the timing parameters, you can enter up to nine instrument block parameters. These are Minecraft blocks that will
be generated under the places where the note blocks go. If you wanted a song with a xylophone and flute sound, you could
use minecraft:bone_block minecraft:clay to generate two tracks, one for xylophone and one for flute. Note, each track
can only play one note, so if you wanted the xylophone to play chords, you might need to add additional
minecraft:bone_block to get more tracks. You can always use minecraft:air to generate a track without any instrument
block.
Although the template generator is limited to one instrument block per track, you can switch out the instrument blocks
to temporarily change the sound, and the selection/compaction system will preserve these changes. So if you want to
have percussion, for example, you may be able to use only one or two tracks even if you use several instruments. A beat
that alternates between bass drum and snare drum could be done on one track: generate the track using minecraft:stone
for the bass drum, then replace the snare drum beats with sand, then repeat the pattern to the end of the song
(WorldEdit's //stack command is excellent for repeating patterns).
Creating your song
After you generate your template, a row of blocks will appear in front of you. This is your marker line. It functions
as a timeline that shows you where the measures and beats line up, to make it easy to keep track. Diamond blocks mark
the first note of each measure, and gold blocks mark the first note of each subsequent beat within that measure.
To the right of the marker line, your tracks are generated. Tracks are generated in groups of three, with repeaters
along the center track to carry a redstone signal. The smooth stone blocks on the second layer are the note blanks;
replace these with note blocks to add your notes. Note that within each group, the first track is generated in the
center, then the second track is generated on the left, and the third is generated on the right. This is because if
a group has only one track, it needs to be in the center where the repeaters are. So, if you generated a template
with nine tracks, the layout will be:
M 2 1 3 5 4 6 8 7 9
This might be surprising at first, but it gives the most efficient final layout after compaction.
To listen to your song, simply use redstone wire to connect a button to the first note block or blank of each center
track. Press the button, then fly along above the song to stay where you can hear it. (When you're done, the compaction
feature will generate a version of the song that you can listen to standing in one place.)
Compacting your song
When you have everything just the way you want it, Note Block Assistant can take your completed song and generate
a compact version of it by folding the tracks together so that the note blocks interlock, and placing each group of
three tracks on a separate layer. This way, your song goes from a long, unwieldy (but easy to edit) line to a 3D build
that takes the smallest space practical and can be built in survival mode if desired. (This is possible to do with
WorldEdit, but it takes some math and a great deal of trouble, which is why this mod was originally created.)
To compact your song, first stand on top of the first diamond block on the marker line, and face the other end of the
marker line. Then, use the command /nba select <tracks>, where tracks is the number of tracks in your song. Note
Block Assistant will scan the marker line in the direction you're facing to calculate the length of the song, then
scan and store all the note blocks, instrument blocks, repeaters, and blanks.
For this reason, while you can swap out instrument blocks and shorten/lengthen the song while you're creating it,
your marker line must remain unbroken and you cannot change the locations of the tracks relative to the marker line.
Note Block Assistant will tell you the length of the song it found. If that's correct, then fly up to a nearby location
and run /nba placeCompact to generate the compact version. To reduce the resources needed to build in survival, Note
Block Assistant will automatically remove any unneeded note blanks and instrument blocks from the compact version, so
there's no need to do this manually beforehand. By default, a glass floor will be generated for each level, to make
building more practical and to hold any falling instrument blocks like sand or gravel. You can use WorldEdit to replace
the floors with something else or remove them if you like. You can also replace the smooth stone blocks with any other
solid block that can be powered at this stage.
By default, Note Block Assistant generates a compacted song that is as close to square as possible, so that you can
stand in the center and all the note blocks will be at a minimum distance and can be heard. If you have a specific area
the song needs to fit into, however, it may be useful to generate a different rectangular shape instead. If this is the
case, you can use /nba placeCompact <length> to specify the length in blocks of one side of the rectangle, and the
song will be automatically made as wide as it needs to be to accommodate that length. Note that extra length is needed
in one direction for the redstone wire to loop around at the end of each row, so while the note blocks will be fit into
the dimension you specify, the final shape will be slightly different based on which side of the rectangle you choose
for <length>.
Once you're happy with the shape of your compacted song, you can use it as a reference to build in survival (the
Litematica mod is by far the best way to do this). Then, hook up a redstone circuit to power the first note block on
each layer simultaneously. There are many ways of doing this, and it depends on how you want the song to be triggered
as well as the place you're building it in, so Note Block Assistant doesn't generate this part.
评论 0
登录后参与评分
还没有评论,来抢沙发吧